Conversation
TREKWhat We're Looking For
Good work on this Michelle! I have a concern about how you handled finding the current trip id, and that may be because of your absences that week. I'm leaving a few comments on it. Otherwise, I think you did a great job with this project. Good work on it! |
| @@ -0,0 +1,152 @@ | |||
| // --- RE-USABLE ---// | |||
| const baseURL = 'https://trektravel.herokuapp.com/trips/'; | |||
| let id = 0; | |||
There was a problem hiding this comment.
You're putting the id in this global scope in order to store what the current trip is... You should consider different approaches to get the value of id. Could you use a closure or read from the HTML? (details about this suggestion below)
| // --- RE-USABLE ---// | ||
| const baseURL = 'https://trektravel.herokuapp.com/trips/'; | ||
| let id = 0; | ||
| const post = '/reservations'; |
There was a problem hiding this comment.
This could probably have a better name
| // }); | ||
| }; | ||
|
|
||
| // did you happen to click on a trip? have i got a trip for you! |
| }; | ||
|
|
||
| // did you happen to click on a trip? have i got a trip for you! | ||
| $(`.trip-list *`).click(loadTripDetails); |
There was a problem hiding this comment.
instead of relying on a selector like this, you'll either want to rely on a closure or event delegation
https://github.com/Ada-Developers-Academy/textbook-curriculum/blob/master/10-JavaScript/closures.md
TREK
Congratulations! You're submitting your assignment!
Comprehension Questions
Tripin the list by it's ID field. Would it be advantageous to keep the list in order by the id field? Explain why or why not.